package com.heima.admin.controller;

import com.heima.admin.dto.NewsAuthDto;
import com.heima.admin.service.IAdAuthService;
import com.heima.admin.vo.WmNewsVo;
import com.heima.common.dto.ResponseResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/news_auth")
public class AuthController {

    @Autowired
    private IAdAuthService iAdAuthService;

    @PostMapping("/list")
    @ApiOperation(value = "查询人工审核文章列表", notes = "author:mcm")
    public ResponseResult findAuthList(@RequestBody NewsAuthDto dto){
        return iAdAuthService.findAuthList(dto);
    }

    @GetMapping("/one/{id}")
    @ApiOperation(value = "查询审核文章", notes = "author:mcm")
    public ResponseResult<WmNewsVo> getOne(@PathVariable Integer id){
        return iAdAuthService.getOne(id);
    }

    @PostMapping("/auth_pass")
    @ApiOperation(value = "人工审核通过", notes = "author:mcm")
    public ResponseResult authPass(@RequestBody NewsAuthDto dto){
        return iAdAuthService.authPassorFail(dto);
    }

    @PostMapping("/auth_fail")
    @ApiOperation(value = "人工审核失败", notes = "author:mcm")
    public ResponseResult authFail(@RequestBody NewsAuthDto dto){
        return iAdAuthService.authPassorFail(dto);
    }
}
